<?php
/**
 * Created by PhpStorm.
 * User: yangh
 * Date: 2017/8/5
 * Time: 9:08
 */

namespace app\api\controller\v1;


use app\api\service\UserToken;
use app\api\validate\TokenGet;
use app\api\service\Token as TokenService;


class Token
{
    public function getToken($code = ''){
        (new TokenGet())->goCheck();
        $ut = new UserToken($code);
        $token = $ut->get();
        return json($token);
    }

    public function checkToken(){
        $user_id = TokenService::getCurrentUid();
        if (!$user_id){
            return json(['isValid' => 'true']);
        }else{
            return json(['isValid' => 'false']);
        }
    }
}